<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ACER
  Date: 2017/6/6
  Time: 19:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
  <style>
    tr{ margin-top: 5px;height: 10px;line-height:30px;}
    table{margin-top: 120px ;}
  </style>
</head>
<body>
<p align="center" style="font-size: 30px;position: relative;top: 40px;">学生信息管理系统</p>
<div align="center" style="position: relative;top: 50px;">
  <form action="/students/search">
    <span style="font-size: 20px;">输入查询的学号或者姓名：</span><input  type="text" name="keyword" style="height: 30px;width: 180px;border-radius: 10px;"/>
    <input type="submit" value="查询" style="height: 30px;width: 50px;border-radius: 10px;background-color: white"/>
  </form>
</div>

<script language="javascript">
  function delcfm() {
    if (!confirm("确认要删除？")) {
      window.event.returnValue = false;
    }
  }
</script>
<table align="center" style="font-size: 25px" border="1px" width="70%"   >
  <tr>
    <th> 学号 </th>
    <th> 密码 </th>
    <th>  姓名</th>
    <th>  性别</th>
    <th> 系别 </th>
    <th>操作</th>
  </tr>

  <c:forEach items="${studentList}" var="student">
    <tr align="center">
      <td>${student.studentNo}</td>
      <td>${student.studentPassword}</td>
      <td>${student.studentName}</td>
      <td>${student.studentSex}</td>
      <td>${student.studentDept}</td>
      <td><a onClick="delcfm()" href="${pageContext.request.contextPath}/students/delete?id=${student.studentId}">删除</a> &nbsp;<a href="${pageContext.request.contextPath}/students/update?id=${student.studentId}&&sno=${student.studentNo}&&password=${student.studentPassword}&&name=${student.studentName}&&sex=${student.studentSex}&&dept=${student.studentDept}">更新</a>&nbsp;<a
              href="${pageContext.request.contextPath}/sc/scList?id=${student.studentId}">查看成绩</a></td>
    </tr>

  </c:forEach>
  <tr align="center" >
    <td colspan="5" align="center">
      <pg:pager  url="/students/studentList" items="${pager.totalRecord}" maxIndexPages="10" maxPageItems="${pager.pageSize}" export="currentPageNumber=pageNumber"><!-- export对pageNumber的重命名 -->
      <pg:first>
        <a href="${pageUrl }">首页</a>
      </pg:first>
      <pg:prev>
        <a href="${pageUrl }">前页</a>
      </pg:prev>
      <pg:pages>
        <c:choose>
          <c:when test="${currentPageNumber eq pageNumber }">
            <font color="red">${pageNumber }</font>
          </c:when>
          <c:otherwise>
            <a href="${pageUrl }">${pageNumber }</a>
          </c:otherwise>
        </c:choose>
      </pg:pages>
      <pg:next>
        <a href="${pageUrl }">后页</a>
      </pg:next>
      <pg:last>
        <a href="${pageUrl }">尾页</a>
      </pg:last>
      <br/>
      当前第${pager.pageIndex}页,共${pager.totalPage}页
      </pg:pager>
    </td>
    <td><a href="/students/add">添加学生</a>
    </td>
  </tr>
</table>
<%--<pg:pager items="200" maxPageItems="15" maxIndexPages="10">--%>


    <%--<pg:first><a href="${pageUrl}">首页</a></pg:first>--%>
    <%--<pg:prev><a href="${pageUrl}">上一页</a></pg:prev>--%>
    <%--<pg:next><a href="${pageUrl}">下一页</a></pg:next>--%>
    <%--<pg:last><a href="${pageUrl}"> 末页</a></pg:last>--%>
<%--</pg:pager>--%>
<%--<jsp:include page="pager.jsp">--%>
  <%--<jsp:param name="url" value="/students/studentList"/>--%>
  <%--&lt;%&ndash;<jsp:param name="items" value="${pager.totalRecord}"/>&ndash;%&gt;--%>
  <%--&lt;%&ndash;<jsp:param name="totalPage" value="${pager.totalPage}"/>&ndash;%&gt;--%>
  <%--&lt;%&ndash;<jsp:param name="maxPageItems" value="${pager.pageSize}"/>&ndash;%&gt;--%>
<%--</jsp:include>--%>


<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>

</body>
</html>
